

import 'package:huajianshe_app/network/response/BaseResp.dart';
import 'package:huajianshe_app/pages/user_info/model/UserModel.dart';
import 'package:json_annotation/json_annotation.dart';

part 'CommentModel.g.dart';

@JsonSerializable()
class CommentListResp extends BaseResp {
  CommentListDataWithPageInfo? data;

  CommentListResp();

  factory CommentListResp.fromJson(Map<String, dynamic> json) => _$CommentListRespFromJson(json);

  @override
  CommentListResp parseFromMap(Map<String, dynamic> map) {
    return CommentListResp.fromJson(map);
  }
}

@JsonSerializable()
class CommentListDataWithPageInfo {
  int? total;
  @JsonKey(name: 'current_page') int? currentPage;
  @JsonKey(name: 'last_page') int? lastPage;
  List<CommentListData>? data;

  CommentListDataWithPageInfo();

  factory CommentListDataWithPageInfo.fromJson(Map<String, dynamic> json) => _$CommentListDataWithPageInfoFromJson(json);
}

@JsonSerializable()
class CommentListData {

  int? id;
  String? content;
  @JsonKey(name: 'create_time_exp') String? createTime;
  @JsonKey(name: 'member_info_box') UserInfo? userInfo;

  CommentListData();

  factory CommentListData.fromJson(Map<String, dynamic> json) => _$CommentListDataFromJson(json);

}

@JsonSerializable()
class CommentResp extends BaseResp { // 对动态回复
  CommentListData? data;

  CommentResp();

  factory CommentResp.fromJson(Map<String, dynamic> json) => _$CommentRespFromJson(json);

  @override
  CommentResp parseFromMap(Map<String, dynamic> map) {
    return CommentResp.fromJson(map);
  }

}